#!/bin/bash

# 运行脚本
echo "=== Running File Server Test ==="

# 默认构建类型
BUILD_TYPE=${1:-Release}

# 检查可执行文件是否存在
EXECUTABLE="out/bin/$BUILD_TYPE/file_server"
if [ ! -f "$EXECUTABLE" ]; then
    echo "✗ Executable not found: $EXECUTABLE"
    echo "Please run build.sh first."
    exit 1
fi

# 创建日志目录
mkdir -p logs

# 运行程序
echo "Running: $EXECUTABLE"
./$EXECUTABLE

# 显示日志
echo ""
echo "=== Log files ==="
ls -lh logs/

# 显示输出目录
echo ""
echo "=== Output files ==="
echo "Executable: $EXECUTABLE"
echo "Libraries: out/lib/$BUILD_TYPE/"
ls -lh out/bin/$BUILD_TYPE/
ls -lh out/lib/$BUILD_TYPE/ 2>/dev/null || echo "No libraries found"
